A few things: The ARs with flags are meant to stay even with the second to last defender (or the ball if it is nearer the goal line), so they should always be marking the offside line 99% of the time (similar to how chain gangs mark first down line and line of scrimmage). (It gets tricky though in a few situations, because one of the AR's other jobs is to ensure the whole of the ball crosses the whole of the goal line and so will stand on the corner where they have the best view of that. This generally should only occur in penalty kicks. This still matters though because a saved or deflected penalty kick is still in play.) Second, a player in their own half or closer to the goal they defend than the ball is, is never off-sides. This is similar to the American football rule allowing backwards lateral passes. Corner kicks are sort of a case of this since they come from the goal line and travel backwards pretty much by definition. Also, players can legally receive the ball in an offside position from opponents in a few rare circumstances.
Actually the assistant referee stays in line with the second-last player on the defending side, counting the goalkeeper. The second-last player could even be the goalkeeper if one defender is behind him, e.g. standing on the goal line.
To complement the rule change when 2 player beat defenders the imaginary offside line is the ball the second player must be behind the ball and the passes are backwards or lateral when 2 forwards face the gaolkeeper
You are correct that in that case the ball represents the offside line, and the other player must remain behind the ball when the pass starts. However, the pass itself can be in any direction, including forward. Check this video at around 1:50. You see that the ball goes mostly sideways but also a bit forward. This is not a problem so this goal was allowed. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-U01-uArNpdw.html
Btw, there is one thing you forgot to mention: An offside is called, if the player receiving the ball is ahead of the ball. So, if an attacking player went all the way to the goal line and cut the ball back to a teammate who is in front of all the defenders, it is NOT offside.
You forgot one thing - the offside rule doesn't apply if it happens in the teams' own half of the pitch. It only applies when in the opposite side. It might not seem like much. but it is, especially during a counter attack.
Thing is if its not a thing then the strikers would literally just wait near the goal for a pass. The game becomes dumb and easy. It's basically like a wall that can be penetrated with timing and pace. It adds more strategy and skill into it