"It depends".
If the types are immutable, where "modifying" operations return a new instance then this could work.
But if there are mutating operations then it will not.
Consider:
Rectangle rect = new Square(10); // Sides of length...
rect.SetWidth(20);
Does that mean rect is no longer a square, does it throw, or does it set the height as well? All three results are bad (and violate Liskov).
In the immutable case rect.SetWidth would return a new instance, each subtype would need to be written with logic to handle switching types when required (eg. in the above rect.SetWidth(10) could return a Square because the sides remain the same length).
While geometrically the hierarchy works, that is because in geometry all operations create new shapes and you then look at the properties of the new shape to classify it. In a statically typed language with mutable objects neither of those restrictions applies.
RightTrianglealready is aShape, as it inherits fromTrianglewhich inherits fromShape. Keep in mind that C# doesn't allow multiple inheritance, so that chain inheritance is the only way to accomplish a similar behavior